package com.yaoayao.mall.item.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author: peiyao
 * @date: 2024/4/14 4:40
 * @description:
 */
@Configuration
public class ThreadPools {

    @Bean(name = "threadPoolExecutor")
    public ThreadPoolExecutor threadPoolExecutor(){
        return new ThreadPoolExecutor(
                6,
                12,
                100,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10)
        );
    }
}
